package dk.twu.analyzer;

import asg.cliche.ShellFactory;
import dk.twu.analyzer.console.Command;
import dk.twu.analyzer.loader.EODDataLoader;
import dk.twu.analyzer.loader.ITDDataLoader;
import dk.twu.analyzer.model.ExchangeList;
import dk.twu.analyzer.model.SymbolList;
import dk.twu.analyzer.util.AnalyzerConfig;

import java.io.IOException;

/**
 * Created by TW on 12/30/2014.
 */
public class ConsoleApp {
    public static final String C_BASE_DIR = "C:\\EOD\\";
    private static final String C_OUTPUT_DIR = "D:\\Workspace\\output\\";
    public static final String C_EXCHANGE_LIST_XML = "ExchangeList.xml";
    public static final String C_SYMBOL_LIST_XML = "SymbolList.xml";
    public static final AnalyzerConfig ANALYZER_CONFIG = new AnalyzerConfig(C_BASE_DIR, C_OUTPUT_DIR, C_EXCHANGE_LIST_XML,
            C_SYMBOL_LIST_XML);

    public static void main(String[] args) {
        ExchangeList exchangeList = ExchangeList.setupExchangeList(ANALYZER_CONFIG);
        SymbolList symbolList = SymbolList.setupSymbolList(ANALYZER_CONFIG, exchangeList.getAllExchange());
        ITDDataLoader itdDataLoader = new ITDDataLoader(ANALYZER_CONFIG);
        EODDataLoader eodDataLoader = new EODDataLoader(ANALYZER_CONFIG);

        try {
            ShellFactory.createConsoleShell("-", "Market Analyzer", new Command(exchangeList, symbolList,
                    itdDataLoader, eodDataLoader)).commandLoop();
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}
